using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QuanLyKho.DAL;
using QuanLyKho.Entity;
namespace QuanLyKho.BL
{
    class bXuatKHo
    {
        DAO dao = new DAO();
        public int insertXuatKho(eXuatKho nk)
        {
            IList<SqlParameter> paramList = new List<SqlParameter>();
            SqlParameter pr = new SqlParameter("@ngayXuat", SqlDbType.DateTime);
            pr.Value = nk.ngayXuat;
            paramList.Add(pr);

            pr = new SqlParameter("@Ten", SqlDbType.NVarChar);
            pr.Value = nk.Ten;
            paramList.Add(pr);

            pr = new SqlParameter("@diaChi", SqlDbType.NVarChar);
            pr.Value = nk.diaChi;
            paramList.Add(pr);

            pr = new SqlParameter("@soDt", SqlDbType.VarChar);
            pr.Value = nk.soDt;
            paramList.Add(pr);

            pr = new SqlParameter("@GhiChu", SqlDbType.NVarChar);
            pr.Value = nk.GhiChu;
            paramList.Add(pr);

            pr = new SqlParameter("@xkId", SqlDbType.Int);
            pr.Direction = ParameterDirection.Output;
            paramList.Add(pr);

            int r = dao.ExecuteNonQuery("insertXuatKho", CommandType.StoredProcedure, paramList);
            r = (int)pr.Value;
            dao.CloseConnection();
            return r;

        }
    }
}
